import request from './request'
const userSer = '/?ser=user';

//登录
export function login(data){
  return request({
    url:'/user/login/?ser=user',
    method:'post',
    params:{
      userName:data.userName,
      password:data.password,
        captcha:data.captcha,
    }
  })
}
//登录
export function phoneLogin(data){
  return request({
    url:'/user/phoneLogin/?ser=user',
    method:'post',
    params:{
      tel:data.tel,
      captcha:data.captcha,
    }
  })
}
export function sendCaptcha(tel){
  return request({
    url:'/captcha/message'+userSer,
    method:'put',
    params:{
      tel
    }
  })
}


export function register(form){
  return request({
    url:'/user/register'+userSer,
    method:'put',
    params:{
      userName:form.username,
      password:form.password,
      tel:form.tel,
      captcha:form.code
    }
  })
}
//退出登录
export function logout(){
  return request({
    url:'/user/logout'+userSer,
  })
}

//获取个人信息
export function getPersonInfo(userName){
  return request({
    url:'/user/personInfo'+userSer,
    params:{
      userName
    },
  })
}
//修改个人信息
export function updatePersonInfo(infoForm){
  return request({
    url:'/user/updatePersonInfo'+userSer,
    method:'post',
    params:{
      graduate:infoForm.graduate,
      edu:infoForm.edu,
      expect:infoForm.expect,
      qq:infoForm.qq,
       userName:infoForm.userName,
       pickName:infoForm.pickName,
       sex:infoForm.sex,
       age:infoForm.age,
       tel:infoForm.tel,
       email:infoForm.email,
       liveCity:infoForm.liveCity,
       position:infoForm.position,
       introduce:infoForm.introduce,
       photoUrl:infoForm.photoUrl
    },
  })
}